#pragma once

#include "AbstractMessageFactory.h"
#include "MessageBase.h"
#include "MessageFwd.h"
#include "GameStateAccessorFwd.h"
#include "GalconRoom.h"
#include <boost/shared_ptr.hpp>
#include "ServerParticipant.h"

class ServerMessageFactory : public AbstractMessageFactory
{
public:
   ServerMessageFactory(GalconRoom&, const ServerParticipantPtr);
   ~ServerMessageFactory(void);

protected:

   virtual MessageBasePtr do_parseMessage(MessagesEnum, split_vector_type_iter, split_vector_type_iter);

private:
   template<typename Iter>
   MessageBasePtr buildShipsLaunchedMessage(Iter, Iter);
   template<typename Iter>
   MessageBasePtr buildShipsArrivedMessage(Iter, Iter);
   ServerParticipantPtr m_serverParticipant;
   GalconRoom& m_galconRoom;
};

typedef boost::shared_ptr<ServerMessageFactory> ServerMessageFactoryPtr;